<!DOCTYPE html>
<html lang="cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>注册</title>
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/newuser.css">
    <script src="../js/angular-1.5.9/angular.min.js"></script>
    <script src="../js/angular-1.5.9/angular-messages.min.js"></script>
    <script src="../js/angular-1.5.9/angular-cookies.min.js"></script>
    <script src="../js/controllers/newuserCtrl.js"></script>
    <script src="../js/directive/cookieDirective.js"></script>
    <script src="../js/directive/newuserDirective.js"></script>
</head>
<body ng-app="myapp" ng-controller="newUserCtrl">
    <div class="container user_box">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h3 class="panel-title">注册帐号</h3>
            </div>
            <div class="panel-body">
                <div class="col-sm-12">
                    <a class="btn btn-link  pull-right" id="index" ng-href="{{login_host}}">返回登录页面</a>
                </div>
                <form class="form form-horizontal col-sm-8 col-sm-offset-2" name="myForm" action="register.action" method="post">
                    <div class="form-group" login-msg></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">帐号</label>
                        <div class="col-sm-10">
                            <div class="col-sm-8">
                                <input type="text" name="tel" ng-model="newuser.tel" placeholder="请输入手机号" class="form-control" ng-pattern="/^1[3|4|7|5|8][0-9]\d{8}$/"></div>
                                <div class="col-sm-4 text-alert control-label text-danger" ng-show="myForm.tel.$dirty" ng-messages="myForm.tel.$error">
                                    <span ng-message="pattern">电话号码格式错误</span>
                                </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">验证码</label>
                        <div class="col-sm-10">
                            <div class="col-sm-5">
                                <input type="text" name="code" ng-model="newuser.code" placeholder="请输入验证码" class="form-control" required ng-minlength="6" ng-maxlength="6">
                            </div>
                            <div class="col-sm-3"><button type="button" ng-disabled="!newuser.tel" class="btn btn-primary btn-block" login-code ng-click="loginCode()">发送验证码</button></div>
                            <div class="col-sm-4 text-alert control-label text-danger" ng-show="myForm.code.$dirty" ng-messages="myForm.code.$error">
                                <span ng-message="required">验证码不能为空</span>
                                <span ng-message="minlength">验证码应为6位</span>
                                <span ng-message="maxlength">验证码应为6位</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">用户名</label>
                        <div class="col-sm-10">
                            <div class="col-sm-8">
                                <input type="text" name="userid" ng-model="newuser.userid" placeholder="请输入用户名" class="form-control" required ng-maxlength="6"></div>
                            <div class="col-sm-4 text-alert control-label text-danger" ng-show="myForm.userid.$dirty" ng-messages="myForm.userid.$error">
                                <span ng-message="required">用户名不能为空</span>
                                <span ng-message="maxlength">用户名不能长于6位</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">密码</label>
                        <div class="col-sm-10">
                            <div class="col-sm-8">
                                <input type="password" name="password" ng-model="newuser.pass" placeholder="请输入密码" class="form-control" required ng-minlength="6"
                                    ng-maxlength="16"></div>
                            <div class="col-sm-4 text-alert control-label text-danger" ng-show="myForm.password.$dirty" ng-messages="myForm.password.$error">
                                <span ng-message="required">密码不能为空</span>
                                <span ng-message="minlength">密码不能小于6位</span>
                                <span ng-message="maxlength">密码不能大于16位</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">再次输入密码</label>
                        <div class="col-sm-10">
                            <div class="col-sm-8">
                                <input type="password" name="repw" ng-model="newuser.password" placeholder="再次输入密码" class="form-control" required></div>
                            <div class="col-sm-4 text-alert control-label text-danger" ng-show="myForm.repw.$dirty" ng-messages="myForm.repw.$error">
                                <span ng-message="required">密码不能为空</span>
                                <span ng-show="newuser.pass!=newuser.password">两次密码不符</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-info col-sm-2 col-sm-offset-4" ng-disabled="(newuser.tel&&newuser.userid&&newuser.pass&&newuser.password==newuser.pass)?false:true"
                            ng-submit="removecookie()">注册</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>

</html>